@extends('admin.public.admin')
@section('main')
<script src="/style/admin/js/libs/jquery-1.8.3.min.js"></script>/
<script src="/style/admin/js/sys/sysads.js"></script>
<meta name="csrf-token" content="{{ csrf_token() }}">
<div class="mws-panel grid_8">
  <div class="mws-panel-header">
    <span>
      <i class="icon-table"></i>广告管理</span>
  </div>
  <div class="mws-panel-body no-padding">
    <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">
      <div id="DataTables_Table_0_length" class="dataTables_length">
        <label>

            <form method="get" action="/admin/sys/typeads"><!--用来分页的form表单-->

          <select size="1" name="count" aria-controls="DataTables_Table_0">
            <option value="10" @if(!empty($request['count']) && $request['count']== 10) selected @endif>10</option>
            <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option>
            <option value="30" @if(!empty($request['count']) && $request['count'] == 30) selected @endif>30</option>
            <option value="40" @if(!empty($request['count']) && $request['count'] == 40) selected @endif)>40</option></select>页</label>
      </div>
      <div class="dataTables_filter" id="DataTables_Table_0_filter">
        <a href="/admin/sys/typeads/create"><button type="button" class="btn btn-success">添加广告</button></a>
        <label>
          <input type="text" name="search" value="{{$request['search'] or ''}}" aria-controls="DataTables_Table_0"></label>
            <button type="submit" class="btn btn-success">搜索</button>
          </div>

        </form>

        <label>
       <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
        <thead>
          <tr role="row">
            <th>ID</th>
            <th>所属分类</th>
            <th>图片</th>
            <th>标题</th>
            <th>连接</th>
            <th>排序</th>
            <th>是否大图</th>
            <th>操作</th>
        </thead>
         <?php 
                  $num=0;
                ?>
        <tbody  aria-live="polite" aria-relevant="all">
    @if($data)
          @foreach($data as $key=>$v)
          <tr class="">
            <td class="sorting_1">{{++$num}}</td>
            <td class=" ">{{\DB::table("types")->where('id',$v['tid'])->first()['typename']}}</td>
            <td class=" "><img width="100" height="50" src="{{$v['img']}}" alt="" /></td>
            <td class=" ">{{$v['title']}}</td>
            <td class=" ">{{$v['href']}}</td>
            <td class=" ">{{$v['sort']}}</td>
            <td class=" ">
            @if($v['type']==0)
            <a href="/admin/sys/typeads/{{$v['id']}}"><button type="button" class="btn tn-danger">否</button></a>
            @else
            <a href="/admin/sys/typeads/{{$v['id']}}"><button type="button" class="btn btn-success">是</button></a>
            @endif
            </td>
            <td class=" ">
              <a href="/admin/sys/typeads/{{$v['id']}}/edit"><button type="button" class="btn btn-success">修改</button></a>
             <button type="button" onclick="mm({{$v['id']}})" class="btn btn-danger">删除</button>
            </td></tr>
            @endforeach
    @endif
          </tbody>
      </table>
      <!-- 分页 -->
              <div id="page_page">
                   {!! $data->appends($request)->render()!!}
              </div>
    </div>
  </div>
</div>

@endsection